package quantri.login;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/******************************************
 * Filename			: CheckLogin.java
 * Description		:
 * Created date		: Sep 12, 2008
 * Author			: Phonglt
 ******************************************/
public class CheckLogin extends javax.servlet.http.HttpServlet implements
		javax.servlet.Servlet {
	static final long serialVersionUID = 1L;

	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		System.out.println("servlet checklogin");
		HttpSession session = request.getSession();
		User user = (User) session.getAttribute("user");
		String username = (String) request.getAttribute("j_username");
		String password = (String) request.getAttribute("j_password");
		user.setUserName(username);
		user.setPassword(password);
		user.CheckLogin();
		response.sendRedirect("/");
	}

	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		this.doGet(request, response);
	}
}